package com.entity;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 【车辆管理】 车辆信息
 */

@Entity
@Table(name = "vehicle_info")
@Getter @Setter @NoArgsConstructor
public class VehicleInfo extends BaseEntity {

    @Column(name = "plate_number", length = 20)
    private String plateNumber;

    @Column(name = "vehicle_type")
    private String vehicleType;

    @Column(name = "is_new_energy", columnDefinition = "TINYINT(1) default 0")
    private boolean isNewEnergy;

    private String companyName;

    @Column(name = "purchase_date")
    @Temporal(TemporalType.DATE)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date purchaseDate;

    @Column(name = "initial_mileage", precision = 10, scale = 2, columnDefinition = "DECIMAL(10,2) default 0")
    private BigDecimal initialMileage = BigDecimal.ZERO;

    @Column(name = "current_mileage", precision = 10, scale = 2, columnDefinition = "DECIMAL(10,2) default 0")
    private BigDecimal currentMileage = BigDecimal.ZERO;

    @Column(name = "status", columnDefinition = "TINYINT default 1")
    private Integer status;

    @Column(name = "remark", length = 500)
    private String remark;

}